
function init() {
	_initHeader();

	$('#testButton').click(doTest);
}

function doTest() {
	jsniCaller.invoke("SampleJSNI.sampleFunction", 1, "param2", true, "successCallback");
}

function successCallback(message) {
	alert("native webview returned : " + message);
}

function drawBuddyList(buddyList) {

	//alert(buddyList);
	var decodedBuddyList = decodeURIComponent(buddyList);
	//alert(decodedBuddyList);
	var buddyList = eval(decodedBuddyList);


	var array = new Array();
	for (var i = 0; i < buddyList.length; i++) {
		array.push(buddyList[i].groupName);
	}
	// array.push("bk 1");
	draw_list(array);

}

function setOnListClickHandler(idx) {
	switch(idx) {
		case 0 :
			navigate("alopexController");
		break;
		
		case 1 :
			navigate("application");
		break;
		
		case 2 :
			navigate("contact");
		break;
		
		case 3 :
			navigate("database");
		break;
		
		case 4 :
			navigate("device");
		break;
		
		case 5 :
			navigate("event");
		break;
		
		case 6 :
			navigate("file");
		break;
		
		case 7 :
			navigate("geolocation");
		break;
		
		case 8 :
			navigate("globalPreference");
		break;
		
		case 9 :
			navigate("http");
		break;
		
		case 10 :
			navigate("localNotification");
		break;
		
		case 11 :
			navigate("log");
		break;
		
		case 12 :
			navigate("memoryPreference");
		break;
		
		case 13 :
			navigate("multimedia");
		break;
		
		case 14 :
			navigate("nativeUI");
		break;
		
		case 15 :
			navigate("navigation");
		break;
		
		case 16 :
			navigate("phone");
		break;
		
		case 17 :
			navigate("platformUIComponent");
		break;
		
		case 18 :
			navigate("preference");
		break;
		
		case 19 :
			navigate("pushNotification");
		break;
		
		case 20 :
			navigate("sensor");
		break;
		
		case 21 :
			navigate("nativeExtension");
		break;
		
		default :
		break;
	}
}

function onScreenBack() {
	var str = "";
	
	if(navigation.results) {
		for( var name in navigation.results) {
			str += name + " : " + navigation.results[name] + "\n";
		}
		
		alert("navigation.results = " + str);
	}
	
	navigation.results = null;
}